import java.util.*;

public class Main {
    // MP3光标位置
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String option = in.next();
        if (n <= 4) {
            operateLocal(n, option);
        } else {
            operateDap(n, option);
        }
    }

    private static void operateDap(int n, String option) {
        char[] op = option.toCharArray();
        int[] screen = new int[4];
        int res = 1;
        for (char c : op) {
            if (c == 'U') {
                if (res == 1) {
                    res = n;
                    for (int i = 0; i < screen.length; i++) {
                        screen[i] = n - 3 + i;
                    }
                } else if (res == screen[0]) {
                    res = res - 1;
                    for (int i = 0; i < screen.length; i++) {
                        screen[i] = screen[i] - 1;
                    }
                } else {
                    res = res - 1;
                }
            } else {
                if (res == n) {
                    res = 1;
                    for (int i = 0; i < screen.length; i++) {
                        screen[i] = i + 1;
                    }
                } else if (res == screen[3]) {
                    res = res + 1;
                    for (int i = 0; i < screen.length; i++) {
                        screen[i] = screen[i] + 1;
                    }
                } else {
                    res = res + 1;
                }
            }
        }
        for (int j : screen) {
            System.out.print(j + " ");
        }
        System.out.println();
        System.out.println(res);
    }

    private static void operateLocal(int n, String option) {
        char[] op = option.toCharArray();
        int res = 1;
        for (char c : op) {
            if (c == 'U') {
                if (res == 1) {
                    res = n;
                } else {
                    res = res - 1;
                }
            } else {
                if (res == n) {
                    res = 1;
                } else {
                    res = res + 1;
                }
            }
        }
        for (int i = 1; i <= n; i++) {
            System.out.print(i + " ");
        }
        System.out.println();
        System.out.println(res);
    }


    // 洗牌
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int m = in.nextInt();
        while (m-- != 0) {
            int n = in.nextInt();
            int k = in.nextInt();
            List<Integer> res = new LinkedList<>();
            for (int i = 0; i < 2 * n; i++) {
                res.add(in.nextInt());
            }
            for (int i = 0; i < k; i++) {
                res = shuffle(res);
            }
            for (int x : res) {
                System.out.print(x + " ");
            }
            System.out.println();
        }
    }

    private static List<Integer> shuffle(List<Integer> list) {
        int[] arr1 = new int[list.size() / 2];
        int[] arr2 = new int[list.size() / 2];
        List<Integer> res = new LinkedList<>();
        for (int i = 0; i < list.size() / 2; i++) {
            arr1[i] = list.get(i);
        }
        for (int i = list.size() / 2, j = 0; i < list.size(); j++, i++) {
            arr2[j] = list.get(i);
        }
        for (int i = arr1.length - 1; i >= 0; i--) {
            res.add(arr2[i]);
            res.add(arr1[i]);
        }
        Collections.reverse(res);
        return res;
    }
}
